package jp.co.lty.mai;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.pirkaengine.core.PirkaException;
import org.pirkaengine.slim3.PirkaPage;
import org.slim3.controller.Navigation;

import scenic3.annotation.ActionPath;
import scenic3.annotation.Default;
import scenic3.annotation.Page;

@Page("/greeting")
public class GreetingPage extends PirkaPage  {

    /**
     * PirkaEngineを使いindex.htmlを表示します
     * @return
     * @throws IOException
     * @throws PirkaException
     */
    @Default
    public Navigation index() throws PirkaException, IOException {
        viewModel("greeting", "こんにちは、PirkaEngineの世界へ！");
        return render("greeting.html");
    }

    @ActionPath("list.html")
    public Navigation hello() throws PirkaException, IOException {
        List<String> list = new ArrayList<String>();
        list.add("Java");
        list.add("Python");
        viewModel("list", list);
        return render("list.html");
    }

}
// AppUrlsには手動でMatcherを登録する必要がある。
